<template>
    <div v-if="isShow">
        <h3>即时注单</h3>
        <div class="flexbox spacebetween">
            <p style="cursor: pointer;color: red;" @click="refreshFun"><img src="../../../../assets/images/refresh.png" style="width: 18px;height: 18px;vertical-align:sub;margin-right: 3px;" />刷新</p>
            <div>
                <span>页数：</span>
                <select @change="selchange" style="height: 26px;">
                    <option v-for="(item,index) in infoData.pages" :key="index" :value="item">{{item}}</option>
                </select>
                <span> / {{infoData.pages}} 页 共 {{infoData.total}} 条记录</span>
            </div>
        </div>
        <table class="wq text-center" border="0" cellpadding="0" cellspacing="1">
            <tr class="t_list_caption">
                <td>编号</td>
                <td>注单号/投注日期</td>
                <td>投注类型</td>
                <td>内容</td>
                <td>投注额</td>
                <td>可赢金额</td>
            </tr>
            <tr class="t_td_text" v-for="(item,index) in infoData.list" :key="index">
                <td>{{index+1}}</td>
                <td style="padding: 2px 0px;">{{item.orderID}}<br/>{{item.datetime}}</td>
                <td>{{item.game}}<br/>{{item.period}}期</td>
                <td><span class="colorRed bolds" style="font-size: 12px;">{{item.title}}</span> @ <span class="colorRed bolds" style="font-size: 12px;">{{item.rate}}</span><br/><span v-if="item.balls.length != 0" style="font-size: 13px;">[ {{item.balls.join('，')}} ]</span></td>
                <td>{{item.member.value}}</td>
                <td>{{item.member.wValue.toFixed(1)}}</td>
            </tr>
            <tr style="background: bisque;height: 26px;">
                <td colspan="4" style="text-align: right;">此页面统计：</td>
                <td>{{infoData.sum.current.sumV.toFixed(1)}}</td>
                <td>{{infoData.sum.current.sumW.toFixed(1)}}</td>
            </tr>
            <tr style="background: bisque;height: 26px;">
                <td colspan="4" style="text-align: right;">总计：</td>
                <td>{{infoData.sum.total.sumV.toFixed(1)}}</td>
                <td>{{infoData.sum.total.sumW.toFixed(1)}}</td>
            </tr>
        </table>
    </div>
</template>
<script>

    import axios from 'axios'
    import {lotterytype} from '../../../../assets/js/lotterytype.js'

    export default {
        name: "NoteList",
        props: {  //普通类型：String、Number、Boolean、Null    引用类型： Array、Object
            // openBet: {  //可下注
            //     type: Boolean,
            //     required: true
            // },
            // ninetime: {  //90s
            //     type: Boolean,
            //     required: true
            // },
        },
        data(){
            return{
                infoData: {},
                page: 1,
                params: {},
                isShow: false,
            }
        },
        methods: {
            init(){

                var _this = this;

                this.params = lotterytype.apiParams(this.$route.query.id,this.$route.query.levelid);

                this.$httpGet('/api/wager/today/'+ this.params.nowlottery,{
                        'page': _this.page
                    }).then(response => {
                        
                    if(response.status == 200){
                        _this.infoData = response.data;
                        _this.isShow = true;
                    }

                });

            },
            //刷新
            refreshFun(){
                this.init();  //
            },
            //换页
            selchange(event){
                // console.log(event);
                this.page = event.target.value;
                this.init();
            },
            
        },
        mounted(){
            this.init();
        },
        watch: {
            openBet: function(now,old){
                // console.log(now,old);
                //开奖  刷新路珠数据
                this.init();
                
            },
            ninetime: function(now,old){
                console.log('------------90s  账户信息');
                //90s  刷新数据
                this.init();
            },

        },
    }
</script>
